'use strict';

const {
	title
} = require("process");

const db = uniCloud.database()
exports.main = async (event, context) => {
	const {
		searchVal
	} = event;
	//根据titile进行查询
	const list = await db.collection('article')
		.aggregate()
		.match({
			title: new RegExp(searchVal)
		})
		.project({
			content: 0
		})
		.end()
	return {
		code: 0,
		data: {
			articleList: list.data,
		},
		msg: '数据获取成功',
	}
}